package com.dnake.misc;

import com.dnake.v700.dxml;

public class SysSpecial {
	public static int speed_dial = 0;

	public static final class quick {
		public static int enable = 0;
		public static String url = "sip:100@192.168.12.100";
	}

	public static final class pstn {
		public static int enable = 0;
		public static String url = "sip:100@192.168.12.100";
	}

	public static String url = "/dnake/cfg/sys_special.xml";

	public static void load() {
		dxml p = new dxml();
		if (p.load(url)) {
			speed_dial = p.getInt("/sys/speed_dial", 0);

			quick.enable = p.getInt("/sys/quick/enable", 0);
			quick.url = p.getText("/sys/quick/url");

			pstn.enable = p.getInt("/sys/pstn/enable", 0);
			pstn.url = p.getText("/sys/pstn/url");
		} else
			save();
	}

	public static void save() {
		dxml p = new dxml();
		p.setInt("/sys/speed_dial", speed_dial);

		p.setInt("/sys/quick/enable", quick.enable);
		p.setText("/sys/quick/url", quick.url);

		p.setInt("/sys/pstn/enable", pstn.enable);
		p.setText("/sys/pstn/url", pstn.url);

		p.save(url);
	}
}
